#define _CRT_SECURE_NO_WARNINGS 1
#pragma once
#include <string>
#include <string.h>

#define Sep "/r/n"
#define Sep_len strlen(Sep)

class cutString
{
public:
	// s -> length/r/n_x op _y/r/n
	static bool isEntire(std::string s)
	{
		int first = s.find(Sep);
		if (first == std::string::npos) return false;
		int second = s.rfind(Sep);
		if (second == std::string::npos) return false;
		if (first == second) return false;

		int length = atoi(s.substr(0, first).c_str());
		int size = s.size();

		if (first + length + Sep_len * 2 <= size)
			return true;
		return false;
	}

	//length/r/n_x op _y/r/n -> _x op _y
	std::string cut(std::string& str)
	{
		int first = str.find(Sep);
		int length = atoi(str.substr(0, first).c_str());

		std::string ret = str.substr(first + Sep_len, length);

		str.erase(0, first + Sep_len * 2 + length);

		return ret;
	}
};